import request from '@/utils/request'
import { checkResult } from '@/utils/utils'
import { stringify } from 'qs'
/**
 * 子账号列表
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function subAcountList(data: any) {
  return request({
    url: '/scrm-api/console/login-api/sub-account/list',
    method: 'get',
    params: data
  })
}
/**
 * 新增子账号
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function addSubAcount(data: any) {
  return request({
    url: '/scrm-api/console/login-api/add/sub-account',
    method: 'post',
    data: data
  })
}
/**
 * 禁用子账号
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function disableAccount(data: any) {
  return request({
    url: '/scrm-api/console/login-api/disable/sub-account',
    method: 'post',
    data: data
  })
}
/**
 * 角色列表
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function roleList() {
  return request({
    url: '/scrm-api/console/login-api/sub-account/role/list',
    method: 'get'
  })
}
/**
 * 修改子账号
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function updateAccount(data: any) {
  return request({
    url: '/scrm-api/console/login-api/update/sub-account',
    method: 'post',
    data: data
  })
}
/**
 * 发送重置验证码
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function resetCode(data: any) {
  return request({
    url: '/scrm-api/console/login-api/send/reset-password/sms-code',
    method: 'post',
    data: data
  })
}
/**
 * 重置密码
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function resetPassword(data: any) {
  return request({
    url: '/scrm-api/console/login-api/reset/password',
    method: 'post',
    data: data
  })
}
/**
 * 子账号重置密码
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function initPassword(data: any) {
  return request({
    url: '/scrm-api/console/login-api/reset/init/password',
    method: 'post',
    data: data
  })
}
/**
 * 获取子账号菜单权限
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function menuAuth(data: any) {
  return request({
    url: '/scrm-api/console/login-api/sub-account/menu/auth',
    method: 'get',
    params: data
  })
}
/**
 * 获取子账号菜单权限
 * @param params
 * @returns {PromiseLike<T | never> | Promise<T | never> | *}
 */
export function updateMenuAuth(data: any) {
  return request({
    url: '/scrm-api/console/login-api/sub-account/update/menu/auth',
    method: 'post',
    data: data
  })
}

//通过手机号获取员工
export function getWorkUser(data: any) {
  return request({
    url: '/scrm-api/console/login-api/sub-account/workuser',
    method: 'post',
    data: data
  })
}

export const delAccount = (data: any) => {
  return request({
    url: '/scrm-api/console/login-api/del/sub-account',
    method: 'POST',
    data
  })
}
